import json
from django.shortcuts import render, HttpResponse
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from web.usa.usa import draw
from web.AttGnn.figure import run_er, run_ba, run_fig

PROCESS = [0]

# Create your views here.
def index(request): 
    return render(request, 'index.html', {'usa_map':draw()})

def prediction(request):
    return render(request, 'prediction.html')

def research(request):
    return render(request, 'research.html')

def news(request):
    return render(request, 'news.html')

def prevention(request):
    return render(request, 'prevention.html')

def platform(request):
    return render(request, 'platform.html')

def contact(request):
    return render(request, 'contact.html')

def news_1(request):
    return render(request, 'iframe/news_1.html')

def news_2(request):
    return render(request, 'iframe/news_2.html')

def news_3(request):
    return render(request, 'iframe/news_3.html')

def news_4(request):
    return render(request, 'iframe/news_4.html')

def research_1(request):
    return render(request, 'iframe/research_1.html')

def research_2(request):
    return render(request, 'iframe/research_2.html')

def research_3(request):
    return render(request, 'iframe/research_3.html')

def research_4(request):
    return render(request, 'iframe/research_4.html')

def research_5(request):
    return render(request, 'iframe/research_5.html')

def research_6(request):
    return render(request, 'iframe/research_6.html')

def research_7(request):
    return render(request, 'iframe/research_7.html')

def research_8(request):
    return render(request, 'iframe/research_8.html')

def prevention_1(request):
    return render(request, 'iframe/protection_1.html')

def prevention_2(request):
    return render(request, 'iframe/protection_2.html')

def prevention_3(request):
    return render(request, 'iframe/protection_3.html')

def prevention_4(request):
    return render(request, 'iframe/protection_4.html')

@csrf_exempt
def exp_runer(request):
    return HttpResponse(run_er())

@csrf_exempt
def exp_runba(request):
    return HttpResponse(run_ba())

@csrf_exempt
def exp_runfig(request):
    return HttpResponse(run_fig())

@csrf_exempt
def exp_progress(request):
    return HttpResponse(PROCESS[0])

@csrf_exempt
def usa_map(request):
    return JsonResponse(json.loads(draw()))


    